package com.iplay.实战java高并发程序设计.chapter5.c51;

/**
 * 懒汉式
 * @author dangwu
 * @since 2021/11/5 10:57 上午
 */
public class LazySingleton {
    private LazySingleton(){
        System.out.println("LazySingleton is create");
    }
    private static LazySingleton instance = null;
    private static synchronized LazySingleton getInstance(){
        if (instance == null){
            instance = new LazySingleton();
        }
        return instance;
    }
}
